import os

from google.appengine.ext.webapp import template

from model import Settings

import manager

class SettingsManager(manager.Manager):
    """
    """

    def edit(self):
        """
        """
        # find the template
        path = os.path.join(os.path.dirname(__file__),
                            '../templates', 'settings', 'edit.html')

        # display the settings
        return template.render(path, self.template_values)

    def save(self, settings_key, wiki, author, collection, exposition,
            picture, contact, start, end, select):
        """
        """
        #
        settings = Settings().get(settings_key)

        # set the values
        settings.wiki = wiki
        settings.author = author
        settings.collection = collection
        settings.exposition = exposition
        settings.picture = picture
        settings.contact = contact
        settings.start = start
        settings.end = end
        settings.select = select

        # save contact
        settings.put()
